/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include <UI/UI.h>

#include "../ui属性栏.h"
#include "节点/材质/纹理节点.h"



class C_视频页面 : public C_Widget {

public:
	C_视频页面(S_UI渲染环境& ctx);
	~C_视频页面();

	C_流视频节点*	m_绑定数据_流视频节点;
	S_Operator*		m_Ops特效提取;

	C_Widget*		m_滚动框;
	C_Widget*		m_视频框;
	C_属性栏*		m_属性栏;
	C_状态条*		m_状态条;

};




C_视频页面* f_图像View_创建视频窗口(S_UI渲染环境& ctx);



void f_图像View_设置当前视频视口(C_Widget* w);

void f_图像View_设置显示纹理(S_纹理* tex);

void f_图像View_设置操作视频(C_节点基类* node);



bool on_项选择_切换纹理容器(C_Widget* self, const S_列表填充数据& item);


class C_图像视频视口状态条 : public C_状态条 {
	
public:
	C_图像视频视口状态条(S_UI渲染环境& ctx) : C_状态条(ctx) {
		m_View = nullptr;

		m_纹理映射容器 = f_alloc_MatPtr2DProp(S_节点数据::g_纹理预览容器, u"纹理");
		auto& p = f_prop_映射引用2D(m_纹理映射容器);

		p.mf_元素选择 = on_项选择_切换纹理容器;
	}
	~C_图像视频视口状态条() {

	}

	S_Props		m_纹理映射容器;
	C_视频页面* m_View;

	void f_刷新容器显示(C_节点树* t) {
		uint32 槽 = 0;
		switch (t->m_树类型) {
			case E_节点树类型::e_type_几何节点树: 槽 = DEF_节点树容器槽偏移_几何; break;
			case E_节点树类型::e_type_物体节点树: 槽 = DEF_节点树容器槽偏移_物体; break;
			case E_节点树类型::e_type_材质节点树: 槽 = DEF_节点树容器槽偏移_材质; break;
			case E_节点树类型::e_type_着色节点树: 槽 = DEF_节点树容器槽偏移_着色; break;
			case E_节点树类型::e_type_渲染节点树: 槽 = DEF_节点树容器槽偏移_渲染; break;
			case E_节点树类型::e_type_函数节点树: 槽 = DEF_节点树容器槽偏移_函数; break;
			case E_节点树类型::e_type_包节点树: 槽 = DEF_节点树容器槽偏移_包; break;
				break;
		}


		auto& p = f_prop_映射引用2D(m_纹理映射容器);

		uint32 id = 0;
		for (auto& e : *p.m_PtrItem[槽]) {
			if (e.m_Ptr == t) {
				p.m_当前项 = { 槽, id };
				m_纹理映射容器.m_UI->m_Set(m_纹理映射容器);
				break;
			}
			++id;
		}
	}
};





